<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of project
 *
 * @author truongkx
 */
class lookbook extends CP_Controller{
    //put your code here
    function __construct() {
        parent::__construct('lookbook','lookbook_','id');
    }

    function index(){
        echo $c=$this->load->view('cms/cp/06_lookbook/viewport',$this->assigns,true);
    }
    function beforecommit() {
        parent::beforecommit();
        if(isset($_POST['Params']['lookbook_area']))
        $_POST['Params']['lookbook_area'] = json_encode($_POST['Params']['lookbook_area']);
    }
    function editpanel($type="lookbook"){
        $R["result"] = 1;
        $R["message"]='SUCCESS !';
        $this->assigns->type=$type;
        $Id=(int)$this->input->post('Id');
        if($Id>0){
            $this->assigns->item=$this->backend_model->onGet($Id);
            $this->assigns->item->lookbook_area = json_decode($this->assigns->item->lookbook_area);
            $R['item'] = $this->assigns->item;
        }
        $c=$this->load->view('cms/cp/06_lookbook/editpanel',$this->assigns,true);
        $R["htmlreponse"]=$c;
        $this->output->set_header('Content-type: application/json');
        $this->output->set_output(json_encode($R));
    }
    function binding_by_type($type="lookbook"){
		$this->backend_model->datatables_config=array(
				"table"=>"lookbook",
				"select"=>"SELECT SQL_CALC_FOUND_ROWS * ",
				"from"=>"FROM lookbook",
				"where"     =>"WHERE lookbook_type = '$type'",
				"order_by"=>"ORDER BY `lookbook_insert` DESC",
				"columnmaps"=>array(
						
				)
		);
		$this->bindingdata();
	}
    
    
}

?>
